package com.iflytek.autofly.setting.biz.networking;

import android.text.TextUtils;

import com.iflytek.autofly.bluetoothservice.util.BluetoothServiceCons;

import java.io.Serializable;

/**
 * <b>Description: </b>蓝牙可用设备实体<br/>
 * <b>Change History:</b><br/>
 * <table border="1">
 * <tr>
 * <td><b>user</b></td>
 * <td><b>date</b></td>
 * <td><b>time</b></td>
 * <td><b>reason</b></td>
 * </tr>
 * <tr>
 * <td>yutian2@iflytek.com</td>
 * <td>2015年5月26日</td>
 * <td>上午10:22:21</td>
 * <td>创建此文件</td>
 * </tr>
 * <tr>
 * <td>junluan@iflytek.com</td>
 * <td>2015年6月19日</td>
 * <td>下午2:58:00</td>
 * <td>基于统一的蓝牙服务重构代码</td>
 * </tr>
 * </table>
 *
 * @author yutian2@iflytek.com
 */
public class BtDeviceBean implements Serializable {
    private static final long serialVersionUID = -7433934027924592815L;

    /**
     * 设备名称
     */
    private String name;
    /**
     * 设备状态 ，String描述
     */
    private String stateInString;
    /**
     * 设备mac地址
     */
    private String addr;
    /**
     * 设备状态，int描述
     */
    private int state;
    /**
     * 设备动作
     */
    private String action;

    public BtDeviceBean(String name, String addr, String stateInString, int state, String action) {
        this.name = name;
        if (TextUtils.isEmpty(name)) {
            this.name = addr;
        }
        this.addr = addr;
        this.stateInString = stateInString;
        this.state = state;
        this.action = action;
    }

    public boolean isconnected() {
        return state == BluetoothServiceCons.ConnectionStatus.CONNECTION_CONNECTED;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        if (TextUtils.isEmpty(name)) {
            this.name = addr;
        }
    }

    public String getStateInString() {
        return stateInString;
    }

    public void setStateInString(String stateInString) {
        this.stateInString = stateInString;
    }
}

